#ifndef SIMPLEPLAYER_H
#define SIMPLEPLAYER_H

#include<QObject>
#include<QUrl>
#include<QMediaPlayer>
#include<QTimer>

//Under no circumstances is Song.h to be included here.

#define STOPPED_STATE_TIMEOUT	500

class SimplePlayer: public QObject{
	Q_OBJECT
public:
	enum State{
		Loading,
		Playing,
		Paused,
		Stopped
	};

	SimplePlayer(QObject *parent);
	~SimplePlayer();

	QUrl current()const;

	SimplePlayer::State state()const;
public slots:
	void play();
	void play(QUrl location);
	void pause();
	void stop();
private slots:
	void slotStateChanged(QMediaPlayer::State state);
	void slotFinished();
signals:
	void finished(QUrl);
private:
	QMediaPlayer *m_playerBackend;
	QUrl m_current;
	State m_state;
	QTimer *m_stoppedStateTimer;
};

#endif // SIMPLEPLAYER_H
